<template>
	<view class="container">
		<l-file ref="lFile" @up-success="upSuccess"></l-file>
		<view class="top">
			<view class="tdmc u-border-bottom u-m-l-30">
				<text>公社名称</text>
				<text class="right">{{ model.commune.name }}</text>
			</view>
			<view class="tdmc u-border-bottom u-m-l-30">
				<text>社长</text>
				<text class="right">{{ model.commune.username }}</text>
			</view>
			<view class="tdmc u-border-bottom u-m-l-30">
				<text>公社类型</text>
				<text class="jine right">{{ model.commune.type == 1 ? '普通公社' : model.commune.type == 2 ? '裂变公社' : '供应链公社' }}</text>
			</view>
			<view class="tdmc u-border-bottom u-m-l-30">
				<text>公社领域</text>
				<text class="right" v-if="model.commune.demand != null">{{ model.commune.demand.lb }}</text>
			</view>
			<view class="tdmc u-border-bottom u-m-l-30">
				<text>专业方向</text>
				<text class="right" v-if="model.commune.demand != null">{{ model.commune.demand.professional }}</text>
			</view>
			<view class="u-m-l-30 tdmc u-border-bottom tdtebie">
				<text>公社说明</text>
				<text class="right" v-if="model.commune.demand != null">{{ model.commune.demand.jdsm }}</text>
			</view>
			<view class="fgx"></view>
		</view>
		<view class="u-m-t-30 u-m-l-10 u-m-r-10 ">
			<view class="u-flex u-row-between tdcy u-p-b-30" @click="selectShow(0)">
				<view class="u-font-30 u-m-l-30" style="font-weight: bold;">公社成员</view>
				<view class="u-flex u-row-center u-m-r-30" style="margin-left: auto;">
					<text class="u-font-30" style="color: #AB61FF;" v-if="model.users != undefined">{{ model.users.length }}个</text>
				</view>
				<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(0, true)" v-if="!flagList[0]"></u-icon>
				<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(0, false)" v-if="flagList[0]"></u-icon>
			</view>
			<u-read-more :toggle="toggle" :show-height="showHeight" ref="uReadMore" closeText="收起" open-text="查看全部">
				<view v-for="(item, index) in model.users" :key="index">
					<view class="f-list u-row-between u-border-bottom u-flex u-m-r-20 u-m-l-20 u-p-t-20 u-p-b-20" v-show="flagList[0]" @click="showChildren(index)">
						<block v-if="item.id != $store.state.userInfo.id">
							<view class="u-flex">
								<view class="qylg" :style="{ backgroundImage: 'url(' + logoMask + ')' }">
									<text class="u-line-2">{{ item.username }}</text>
								</view>
								<view class="f-item u-m-l-32">
									<view class="title u-flex u-row-between">
										<view class="">
											<text class="name">{{ item.username }}</text>
											<text v-if="item.leader" class="tz">团长</text>
											<text v-if="item.type == 10" class="td">团队</text>
										</view>
										<view class="bzj" v-if="item.bond">
											<text>￥{{ item.bond }}</text>
										</view>
									</view>
									<view class="explain" v-if="item.type == 10 && item.children.length">团队成员{{ item.children.length }}人</view>
								</view>
							</view>
							<u-icon name="arrow-down" style="margin-right: 20upx;" v-if="item.type == 10 && !item.show"></u-icon>
							<u-icon name="arrow-up" style="margin-right: 20upx;" v-if="item.type == 10 && item.show"></u-icon>
						</block>
						<block v-else>
							<view class="u-flex">
								<view class="qylg" :style="{ backgroundImage: 'url(' + logoMask + ')' }">
									<text class="u-line-2">{{ item.username }}</text>
								</view>
								<view class="f-item u-m-l-32">
									<view class="title u-flex-col">
										<view class="">
											<text class="name">{{ item.username }}</text>
											<text v-if="item.leader" class="tz">团长</text>
										</view>
									</view>
								</view>
							</view>
						</block>
					</view>
					<view class="u-p-20 team-bg u-flex u-flex-wrap" v-if="item.show && item.children && item.children.length">
						<view v-for="(v, t) in item.children" :key="'c' + t" class="qylg u-m-t-10 u-m-l-10" :style="{ backgroundImage: 'url(' + logoMask + ')' }">
							<text class="u-line-2">{{ v.name }}</text>
						</view>
					</view>
				</view>
			</u-read-more>

			<view class="fgx"></view>
		</view>
		<view class="middle-tdxy" style="overflow: hidden;">
			<view @click="selectShow(2)" class=" u-flex u-row-between u-m-l-30 u-m-t-30">
				<view class="u-font-30 xmfp">公社协议</view>
				<view class="u-flex u-row-between">
					<view v-show="show" class="scxy" style="margin-right: 30upx;">
						<image style="" src="../../../static/img/jh.png" mode=""></image>
						<text @click="onUpload(true)">上传协议</text>
					</view>
					<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(2, true)" v-if="!flagList[2]"></u-icon>
					<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(2, false)" v-if="flagList[2]"></u-icon>
				</view>
			</view>
			<view v-for="(item, index) in model.fileAgrees" :key="index" class="tdxy u-m-l-30 u-m-t-30" @click="loadFile(item.path)" v-if="flagList[2]">
				<view class="word u-m-l-30 u-p-t-30">
					<image src="../../../static/img/word.png" mode=""></image>
					<text class="u-line-1">{{ item.oldName }}</text>
				</view>
				<view class="sctime u-m-l-30 u-p-t-30">
					<view class="u-flex">
						<text class="scsj">上传时间:</text>
						<text class="sctime">{{ item.uploadTime }}</text>
					</view>
					<view v-if="$store.state.userInfo.id == item.userId" @click="delFile(item.id)">删除</view>
				</view>
			</view>
		</view>
		<view class="fgx u-m-t-30"></view>
		<view class="middle-hyjy  u-m-t-30">
			<view @click="selectShow(3)" class=" u-flex u-row-between u-m-l-30 ">
				<view class="u-font-30 xmfp">会议纪要</view>
				<view class="u-flex u-row-between">
					<view v-show="show" @click="tonewSummary(id)" class="scxy" style="margin-right: 30upx;">
						<image style="" src="../../../static/img/jh.png" mode=""></image>
						<text>新增纪要</text>
					</view>
					<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(3, true)" v-if="!flagList[3]"></u-icon>
					<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(3, false)" v-if="flagList[3]"></u-icon>
				</view>
			</view>
			<view class="xhx" v-show="flagList[3]"></view>
			<view class="uni-padding-wrap uni-common-mt" v-show="flagList[3]">
				<swiper v-if="model.notepadRecords.length > 0" class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
					<swiper-item v-for="(item, index) in model.notepadRecords" :key="index">
						<view class="u-m-l-30">
							<view class="u-flex u-m-t-35">
								<view class="ty"></view>
								<text class="xmjz">{{ item.title }}</text>
								<text class="sctime" v-if="item.createTime != undefined">{{ item.createTime}}</text>
							</view>
							<view class="u-flex">
								<view class="xx"></view>
								<view style="width: 100%;">
									<view class="zxjz u-m-t-15  u-m-b-15">{{ item.content }}</view>
									<view class="u-flex" v-if="item.imgUrl != undefined">
										<view class="tp" v-for="(xitem, xindex) in item.imgUrl.split(',')" :key="xindex">
											<image @tap="previewImageStr(xindex, item.imgUrl)" :src="getImgUrl(xitem)" style="width: 100%;height: 100%;"></image>
										</view>
									</view>
									<view class="u-m-l-30 u-m-t-20 u-flex u-row-between u-col-center">
										<view class="u-flex u-col-center">
											<view class="tyqk">团员确认情况</view>
											<view class="hekuai" v-if="item.read != null">{{ item.read.length }}/{{ item.read.length + item.unread.length }}</view>
											<view class="hekuai" v-else>0/0</view>
											<view class="u-m-l-30" v-if="$store.state.userInfo.id == item.createUserId" @click="delSummary(item.id)">删除</view>
										</view>
										<view class="u-m-r-30"><image @click="toConfirmation(item)" class="sd" src="../../../static/img/sd.png" mode=""></image></view>
									</view>
								</view>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
			<view class="fgx u-m-t-30"></view>
		</view>

		<view class="top u-m-t-30">
			<view @click="selectShow(4)" class=" u-flex u-row-between u-m-l-30 u-m-b-30 ">
				<view class="u-font-30 xmfp">工程/采购询价</view>
				<view class="u-flex u-row-between">
					<view @click="
					showInquiry = true
					showWdfq = false
				" class="scxy" style="margin-right: 30upx;">
						<image style="" src="../../../static/img/jh.png" mode=""></image>

						<text>询价发布</text>
					</view>
					<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(4, true)" v-if="!flagList[4]"></u-icon>
					<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(4, false)" v-if="flagList[4]"></u-icon>
				</view>
			</view>
			<view v-show="flagList[4]">
				<view v-for="(items, indexs) in model.communeInquiries" :key="indexs">
					<block v-if="items.projectInquiry.type == 1">
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>询价类型</text>
							<text class="right">工程询价</text>
						</view>
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>项目名称</text>
							<text class="right">{{ items.projectInquiry.projectName }}</text>
						</view>
						<view v-if="showDetail[indexs]">
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>项目类型</text>
							<text class="right">{{ items.projectInquiry.projectType }}</text>
						</view>
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>项目阶段</text>
							<text class="right">{{ items.projectInquiry.projectStage }}</text>
						</view>
						<view class="u-m-l-30 tdmc u-border-bottom">
							<text>项目规模</text>
							<text class="right">{{ items.projectInquiry.projectScale }}平方米</text>
						</view>
						<view class="u-m-l-30 tdmc u-border-bottom">
							<text>投资额</text>
							<text class="right">{{ items.projectInquiry.investment }}万元</text>
						</view>
						<view class="u-m-l-30 tdmc u-border-bottom">
							<text>项目地域</text>
							<text class="right">{{ items.projectInquiry.projectRegion }}</text>
						</view>
						<view class="u-m-l-30 tdmc u-border-bottom">
							<text>工作周期</text>
							<text class="right">{{ items.projectInquiry.projectCycle }}个月</text>
						</view>
						<view class="u-m-l-30 tdmc u-border-bottom">
							<text>项目报价</text>
							<text class="right">{{ items.projectInquiry.projectQuoted }}万元</text>
						</view>
						</view>
					</block>
					<block v-else>
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>询价类型</text>
							<text class="right">采购询价</text>
						</view>

						<view class="tdmc u-border-bottom u-m-l-30">
							<text>产品类型</text>
							<text class="right">{{ items.projectInquiry.cplx }}</text>
						</view>
						<view v-if="showDetail[indexs]">
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>产品数量</text>
							<text class="right">{{ items.projectInquiry.cpsl }}</text>
						</view>
						
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>产品规格</text>
							<text class="right">{{ items.projectInquiry.cpgg }}</text>
						</view>
						<view class="tdmc u-border-bottom u-m-l-30">
							<text>单价</text>
							<text class="right">{{ items.projectInquiry.dj }}万元</text>
						</view>
						</view>
					</block>
					<view class="u-m-l-30 tdmc u-border-bottom">
						<text>询价时效</text>
						<text class="right">{{ items.projectInquiry.xjprescripte }}天</text>
					</view>
					<view class="u-m-l-30 tdmc u-border-bottom">
						<text>发布时间</text>
						<text class="right">{{ items.projectInquiry.createTime }}</text>
					</view>
					<view v-if="showProjectInquiryDetails[indexs]">
					<view class="f-list u-border-bottom  u-flex u-m-20 u-p-b-20 u-m-b-0" v-for="(item, i) in items.projectInquiryDetails" :key="'v'+i">
						<view class="qylg" :style="{ backgroundImage: 'url(' + logoMask + ')' }">
							<text class="u-line-2">{{ item.name }}</text>
						</view>
						<view class="f-item u-m-l-32">
							<view class="title u-flex u-m-t-12">
								<view class="">
									<text class="name">{{ item.name }}</text>
									<!-- <text v-if="item.leader" class="tz">团长</text> -->
								</view>
								<view class="bzj u-flex-col u-m-t-20">
									<text>￥{{item.userQuotedPrice}}</text>
									<text class="u-font-26 u-m-t-10">询价结果</text>
								</view>
							</view>
							<view class="explain u-m-t-25">
								未缴保证金
								<text class="u-m-l-10">￥{{ item.bond }}</text>
							</view>
						</view>
					</view>
					</view>
					<view class="u-flex u-row-around">
						<view style="color:#ab61ff"><text v-if="showDetail[indexs]" @click="showDetailClick(indexs)">收起</text><text v-else @click="showDetailClick(indexs)">查看详情</text></view>
						<view class="ckqb u-m-b-30"><text v-if="showProjectInquiryDetails[indexs]" @click="showProjectInquiryDetailsClick(indexs)">收起询价</text><text v-else @click="showProjectInquiryDetailsClick(indexs)">历史询价</text>
						
						<!-- 	<image style="height: 30rpx; width: 30rpx;" src="../../../static/img/gd.png" mode=""></image> -->
						</view>
					</view>
					<view class="fgx"></view>
				</view>
			</view>
			<view class="fgx"></view>
		</view>
		<view class="u-m-l-30 u-m-t-30 ">
			<view class="">
				<view @click="selectShow(5)" class="u-font-30 u-flex u-row-between u-m-b-30" style="font-weight: bold;">
					项目列表
					<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(5, true)" v-if="!flagList[5]"></u-icon>
					<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(5, false)" v-if="flagList[5]"></u-icon>
				</view>
				<view class="xmlb u-m-t-30 u-p-b-30" v-if="flagList[5]">
					<view class="u-m-b-20 u-p-b-10" style="background: #F5F5F9;" v-for="(p, index) in model.projects" :key="p.id">
						<view @click="toProjectAllocation(p)" class="u-flex u-row-between u-p-20 u-border-bottom">
							<view class="tubiao u-flex">{{ p.name }}</view>
							<view class=""><image style="width: 48rpx; height: 48rpx;" src="../../../static/register/xy.png" mode=""></image></view>
						</view>
						<view class="u-p-b-20">
							<view class="u-flex u-m-t-30 u-m-l-28 u-font-30">
								<text class="hz">合同金额</text>
								<text class="js" v-if="p.demand">{{ p.demand.sjfy }}元</text>
							</view>
							<view class="u-flex u-m-t-30 u-m-l-28 u-font-30">
								<text class="hz">项目地点</text>
								<text class="js" v-if="p.demand">{{ p.demand.region }}</text>
							</view>
							<view class="u-flex u-m-t-30 u-m-l-28 u-font-30">
								<text class="hz">甲方</text>
								<text class="js">{{ p.userName }}</text>
							</view>
							<!-- <view class="u-m-t-30 u-m-l-28 u-font-30">
								<text class="hz">乙方</text>
								<text class="js">专业桥梁设计小分队</text>
							</view> -->
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="fgx u-m-t-30"></view>
		<view class=" u-m-b-30  u-p-t-30">
			<view class="u-m-l-30">
				<view @click="selectShow(6)" class="u-flex u-row-between tdcy">
					<view class="u-font-30" style="font-weight: bold;">文件</view>
					<view class="u-flex u-row-between">
						<view v-show="show" class="sc" style="margin-right: 30upx;">
							<image style="" src="../../../static/img/jh.png" mode=""></image>
							<text @click="onUpload(false)">上传</text>
						</view>
						<u-icon name="arrow-down" style="margin-right: 20upx;" @click="selectShow(6, true)" v-if="!flagList[6]"></u-icon>
						<u-icon name="arrow-up" style="margin-right: 20upx;" @click="selectShow(6, false)" v-if="flagList[6]"></u-icon>
					</view>
					<!-- <view class="u-flex u-row-center u-m-r-16">
						<image @click="toFile" style="width: 48rpx; height: 48rpx;" src="../../../static/register/xy.png"></image>
					</view> -->
				</view>
			</view>
			<view class="u-m-b-60" v-if="flagList[6]">
				<block v-for="(item, index) in model.files" :key="item.id">
					<u-swipe-action
						:show="item.show"
						:index="index"
						v-if="$store.state.userInfo.id == item.userId"
						@click="delFiles"
						@open="openFiles"
						:options="options"
						style="width: 100%;"
					>
						<view class="f-list u-flex u-p-t-20 u-p-b-20 u-col-center" style="display: flex;justify-content: space-between;">
							<view class="qylg"><image style="width: 64rpx; height: 64rpx;" src="../../../static/img/file.png" mode=""></image></view>
							<view class="f-item" style="flex: 1;" @click="onOpenDoc(item.path)">
								<view class="u-font-34">
									<text style="display:block;width:400rpx;" class="u-line-1">{{ item.oldName }}</text>
								</view>
								<view class="title u-flex u-m-t-12" style="width: 80%;">
									<text class="name">{{ item.userName }}</text>
									<view class="u-flex u-row-between" style="width: 100%;">
										<text class="rq">{{ item.uploadTime.substr(0, 10) }}</text>
										<text class="wjdx">{{ item.size / 1000 + 'KB' }}</text>
									</view>
								</view>
							</view>
							<view class="xz" @click="onDown(item.path)" style="margin-right: 20upx;">下载</view>
						</view>
					</u-swipe-action>
					<view class="f-list u-flex u-p-t-20 u-p-b-20 u-col-center" v-else style="display: flex;justify-content: space-between;">
						<view class="qylg "><image style="width: 64rpx; height: 64rpx;" src="../../../static/img/file.png" mode=""></image></view>
						<view class="f-item " style="flex: 1;" @click="onOpenDoc(item.path)">
							<view class="u-font-34">
								<text style="display:block;width:400rpx;" class="u-line-1">{{ item.oldName }}</text>
							</view>
							<view class="title u-flex u-m-t-12" style="width: 80%;">
								<text class="name">{{ item.userName }}</text>
								<view class="u-flex u-row-between" style="width: 100%;">
									<text class="rq">{{ item.uploadTime.substr(0, 10) }}</text>
									<text class="wjdx">{{ item.size / 1000 + 'KB' }}</text>
								</view>
							</view>
						</view>
						<view class="xz" @click="onDown(item.path)" style="margin-right: 20upx;">下载</view>
					</view>
				</block>
			</view>
		</view>
		<!--底部弹出我的询价窗口-->
		<u-popup border-radius="0" v-model="showInquiry" :mode="modeBottom" :mask="mask" :closeable="closeable" :close-icon-pos="closeIconPos" :safe-area-inset-bottom="true">
			<view style="overflow: auto; background-color: #fff" :style="{ height: scrollHeight - 50 + 'px' }">
				<m-inquiry :datas="myInquiry" @click="handleClickInquiry"></m-inquiry>
			</view>
		</u-popup>
	</view>
</template>

<script>
import lFile from '@/components/l-file/l-file.vue'
export default {
	components: { lFile },
	data() {
		return {		
			showProjectInquiryDetails:[],
			show: false,
			mode: 'right',
			mask: true, // 是否显示遮罩
			closeable: true,
			closeIconPos: 'top-right',
			modeBottom: 'bottom',
			showInquiry: false,	
			showWdfq: false,
			showDetail:[],
			logoMask: this.$mAssetsPath.logoMask,
			localPath: '',
			baseUrl: this.$mConfig.baseUrl,
			indicatorDots: true,
			autoplay: false,
			interval: 2000,
			duration: 500,
			flagList: [false, false, false, false, false, false],
			id: 0,
			toggle: false,
			showHeight: 300,
			height: 20,
			bjxm: '../../static/homepage/xmkk.png',
			list: [],
			filelist: [],
			model: {
				commune: {},
				fileAgrees: [],
				communeInquiries: [],
				files: [],
				notepadRecords: []
			},
			isLeader: false,
			userId: '',
			myInquiry: []
		}
	},
	onLoad(options) {
		if (options.id) {
			this.id = options.id
		}
		if (options.userId) {
			this.userId = options.userId
		}
		if (options.teamChatId) {
			this.teamChatId = options.teamChatId
			this.checkLeader()
		}
		this.initPage(this.id)
		
			var that = this
			uni.getSystemInfo({
				success: function(res) {
					that.scrollHeight = res.windowHeight
				}
			})
	},
	onShow() {
		this.initPage(this.id)
		this.getMyInquiry()
	},
	methods: {		
		showProjectInquiryDetailsClick(e){
			this.showProjectInquiryDetails[e] = !this.showProjectInquiryDetails[e];
			this.$forceUpdate()
		},
		async handleClickInquiry(e) {
			if (e.model.projectName == '') {
				uni.showToast({
					title: '请填写项目名称',
					icon: 'none'
				})
				return
			}
			e.model.expiredTime = new Date(e.model.expiredTime).getTime()
			let result = await this.$apis.addInquiry(e.model)
			if (result.code == 200) {
				uni.showToast({
					title: '询价提交成功',
					icon: 'none'
				})
				this.initPage(this.id)
			}
		},
		async getMyInquiry() {
			let result = await this.$apis.findProvinceCityDistrictByTree()
			this.myInquiry = result.data
		},
		showDetailClick(e){
			this.showDetail[e] = !this.showDetail[e];
			this.$forceUpdate()
			console.log(this.showDetail);
		},
		async fetchGroupPersonBond(reqBody, index) {
			console.log('index', index)
			let { data } = await this.$apis.fetchGroupPersonBond(reqBody)
			let users = this.model.users[index] ? this.model.users[index] : []
			users.children = data
			users.show = !users.show
			this.model.users[index] = users

			console.log(this.model.users)
			this.$forceUpdate()
		},
		showChildren(index) {
			let users = this.model.users
			if (users && users[index] && users[index].type == 10) {
				var fromTeamId = users[index].fromTeamId.split('_')
				console.log('fromTeamId', fromTeamId)
				if (fromTeamId.length && fromTeamId[1] > 0) {
					let reqBody = {
						id: fromTeamId[1],
						type: 1
					}
					this.fetchGroupPersonBond(reqBody, index)
				}
			}
		},
		// 如果打开一个的时候，不需要关闭其他，则无需实现本方法
		open(index) {
			console.log('open', index)
			// 先将正在被操作的swipeAction标记为打开状态，否则由于props的特性限制，
			// 原本为'false'，再次设置为'false'会无效
			this.courses[index].show = true
			this.courses.map((val, idx) => {
				if (index != idx) this.courses[idx].show = false
			})
		},
		delFiles(index) {
			var that = this
			uni.showModal({
				content: '删除该文件',
				success(res) {
					if (res.confirm) that.deleteFileAgrees(index)
				}
			})
		},
		async deleteFileAgrees(index) {
			let { code } = await this.$apis.deleteFileAgree({ id: this.model.files[index].id })
			if (code == 200) {
				this.model.files.splice(index, 1)
			}
		},
		// 如果打开一个的时候，不需要关闭其他，则无需实现本方法
		openFiles(index) {
			console.log('open', index)
			// 先将正在被操作的swipeAction标记为打开状态，否则由于props的特性限制，
			// 原本为'false'，再次设置为'false'会无效
			this.model.files[index].show = true
			this.model.files.map((val, idx) => {
				if (index != idx) this.model.files[idx].show = false
			})
		},
		delFile(id) {
			var that = this
			uni.showModal({
				content: '删除该文件',
				success(res) {
					if (res.confirm) that.deleteFileAgree(id)
				}
			})
		},
		async deleteFileAgree(id) {
			let { code } = await this.$apis.deleteFileAgree({ id: id })
			if (code == 200) {
				this.initPage(this.id)
			}
		},
		delSummary(id) {
			var that = this
			uni.showModal({
				content: '删除该纪要',
				success(res) {
					if (res.confirm) that.deleteNotepadRecord(id)
				}
			})
		},
		async deleteNotepadRecord(id) {
			let { code } = await this.$apis.deleteNotepadRecord({ id: id })
			if (code == 200) {
				this.initPage(this.id)
			}
		},
		async checkLeader() {
			let result = await this.$apis.checkLeader({ teamChatId: this.teamChatId })
			this.isLeader = result.data
			if (!this.isLeader && this.userId != '') {
				this.show = false
			}
		},
		getImgUrl(url) {
			return this.$mConfig.baseUrl + url
		},
		scroll(event) {
			//距离每个边界距离
			console.log(event.detail)
		},
		//滚动到底部/右边触发
		scrolltolower() {
			console.log(1111)
		},
		// 滚动到顶部/左边触发
		scrolltoupper() {
			console.log(2222)
		},
		selectShow(index, flag) {
			this.flagList[index] = !this.flagList[index]
			this.initPage(this.id)
			this.$forceUpdate()
		},
		onOpenDoc(file) {
			let url = this.$mConfig.baseUrl + file
			/* 下载返回临时路径（退出应用失效） */
			this.$refs.lFile.download(url).then(path => {
				/* 预览 */
				this.$refs.lFile.open(path)
			})
		},
		/* 保存 */
		onDown(file) {
			let url = this.$mConfig.baseUrl + file
			this.$refs.lFile.download(url, 'local').then(path => {
				this.localPath = path
			})
		},
		/* 上传 */
		onUpload(flag) {
			this.$refs.lFile.upload({
				// #ifdef APP-PLUS
				// nvue页面使用时请查阅nvue获取当前webview的api，当前示例为vue窗口
				currentWebview: this.$mp.page.$getAppWebview(),
				// #endif
				//非真实地址，记得更换,调试时ios有跨域，需要后端开启跨域并且接口地址不要使用http://localhost/
				url: this.$mConfig.baseUrl + '/notepad/saveFile',
				//默认file,上传文件的key
				name: 'file',
				// header: {'Authorization':'token'},
				//...其他参数
				formData: {
					businessId: this.id,
					isAgree: flag,
					type: 3,
					userId: this.userId
				},
				header: {
					'X-requested-With': 'XMLHttpRequest',
					'ZC-TOKEN': uni.getStorageSync('token')
				}
			})
		},
		upSuccess(res) {
			this.initPage(this.id)
		},
		loadFile(file) {
			uni.downloadFile({
				url: this.$mConfig.baseUrl + file,
				success: function(res) {
					var filePath = res.tempFilePath
					uni.openDocument({
						filePath: filePath,
						success: function(res) {
							console.log('打开文档成功')
						}
					})
				}
			})
		},
		// async initPage(id) {
		// 	let result = await this.$apis.communeInfo({
		// 		id: id
		// 	});
		// 	this.model = result.data;
		// },
		async initPage(id) {
			let reqBody = {
				id: id,
				type: 3
			}
			if (this.userId != '') reqBody['userId'] = this.userId
			let result = await this.$apis.summary(reqBody)
			this.model = result.data
			var users = []
			if (this.model.demand && this.model.demand.integrityDeposit) {
				for (var i in this.model.users) {
					users[i] = this.model.users[i]
					users[i].children = []
					users[i].show = false
					if (this.model.users[i].blod && this.model.users[i].id == that.$store.state.userInfo.id) {
						that.myblod = this.model.users[i].blod
					}
				}
			} else {
				for (var i in this.model.users) {
					users[i] = this.model.users[i]
					users[i].children = []
					users[i].show = false
				}
			}
			this.model.users = users
			
			var showDetail = [];
			var  showProjectInquiryDetails = [];
			for (var i in this.model.communeInquiries) {
				showDetail.push(false);	
				showProjectInquiryDetails.push(false);	
			}
			this.showDetail = showDetail;
			this.showProjectInquiryDetails = showProjectInquiryDetails;
			console.log("showDetail",showDetail)
			this.$forceUpdate()
		},
		toTeamMembers() {
			let param = ''
			if (this.userId != '') param = '?userId=' + this.userId
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/teamMembers' + param
			})
		},
		toProjectAllocation() {
			let param = ''
			if (this.userId != '') param = '?userId=' + this.userId
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/projectAllocationDetails' + param
			})
		},
		tohomepage() {
			uni.navigateTo({
				url: '../../homepage/homepage'
			})
		},
		toteamPage() {
			uni.navigateTo({
				url: '../../homepage/teamPage'
			})
		},
		tonewSummary(id) {
			let param = ''
			if (this.userId != '') param = '&userId=' + this.userId
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/newSummary?&type=3&id=' + id + param
			})
		},
		toinquiryRelease() {
			let param = ''
			if (this.userId != '') param = '&userId=' + this.userId
			let id = this.model.commune.id
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/inquiryRelease?id=' + id + param
			})
		},
		toConfirmation(item) {
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/confirmation?id=' + item.id
			})
		},
		toMinutesOfMeeting() {
			uni.navigateTo({
				// url:"../../notepad/zhihuiTeam/minutesOfMeeting"
			})
		},
		toFile() {
			let param = ''
			if (this.userId != '') param = '?userId=' + this.userId
			uni.navigateTo({
				url: '../../notepad/zhihuiTeam/file' + param
			})
		}
	}
}
</script>
<style>
page {
	background-color: #f5f5f9;
}
</style>
<style scoped lang="scss">
.container {
	background-color: #fff;
}

.td {
	padding: 0 5rpx;
	color: #ffffff;
	font-size: 24rpx;
	height: 36rpx;
	background: #19c07d;
	border-radius: 6rpx;
	margin-left: 20rpx;
}
.tdmc {
	line-height: 100rpx;
	width: 90%;
	margin-left: 5%;

	text {
		font-size: 30rpx;
		color: #0d1d36;
	}

	.right {
		position: absolute;
		left: 228rpx;
	}

	.jine {
		position: absolute;
		left: 228rpx;
		font-size: 30rpx;
		color: #ab61ff;
	}
}

.fgx {
	width: 100%;
	height: 20rpx;
	background-color: #f5f5f9;
}

.xmkk {
	width: 102rpx;
	height: 118rpx;
	background-repeat: no-repeat;
	background-size: 100% auto;
	background-position: 0 bottom;

	text {
		color: #888d99;
		font-size: 26rpx;
		line-height: 118rpx;
		margin-left: 27rpx;
	}
}

.xmfp {
	color: #0d1d36;
	font-weight: bold;
}

.xmfpxj {
	width: 690rpx;
	background: #f5f5f9;
	border-radius: 10rpx;

	.tubiao {
		color: #0d1d36;
		font-size: 30rpx;
	}

	.xhx {
		width: 100%;
		height: 1rpx;
		background-color: #cacedb;
		margin-top: 20rpx;
	}
}

.file-name {
	width: 102rpx;
	height: 118rpx;
	background-size: 100% auto;
	background-position: 0 bottom;
	overflow: hidden;
	text-align: center;

	text {
		color: #888d99;
		font-size: 26rpx;
	}
}

.title {
	display: flex;
	justify-content: space-between;
	padding-right: 40rpx;
}

.tz {
	width: 68rpx;
	color: #ffffff;
	font-size: 24rpx;
	height: 36rpx;
	background: #ab61ff;
	border-radius: 6rpx;
	margin-left: 20rpx;
}

.name {
	font-size: 30rpx;
	color: #0d1d36;
	font-weight: bold;
}

.explain {
	color: #888d99;
	font-size: 26rpx;
}

.fpblsz {
	width: 68rpx;
	height: 36rpx;
	border: 2rpx solid #4b9cff;
	border-radius: 6rpx;
	margin-left: 10rpx;
	padding: 0 10upx;
}

.fpbl {
	position: absolute;
	left: 500rpx;
	display: flex;
	align-items: center;

	text {
		font-size: 24rpx;
		color: #4b9cff;
	}

	.fpblsz {
		width: 68rpx;
		height: 36rpx;
		border: 2rpx solid #4b9cff;
		border-radius: 6rpx;
		margin-left: 10rpx;
		padding: 0 10upx;
	}

	.bfh {
		font-size: 24rpx;
		margin-left: 15rpx;
	}
}

.ckqb {
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 26rpx;
	color: #ff8f28;
	margin-top: 30rpx;
}

.xhx {
	width: 100%;
	height: 2rpx;
	background-color: #dadfed;
	margin-top: 34rpx;
}

.scxy {
	display: flex;
	align-items: center;
	width: 190rpx;
	height: 52rpx;
	border: 2rpx solid #ab61ff;
	border-radius: 26rpx;
	color: #ab61ff;
	font-size: 26rpx;

	image {
		width: 30rpx;
		height: 30rpx;
		margin-top: 5rpx;
		margin-left: 26rpx;
	}
}

.tdxy {
	width: 690rpx;
	height: 159rpx;
	background: #f5f5f9;
	border-radius: 20rpx;

	.word {
		display: flex;
		align-items: center;

		image {
			width: 41rpx;
			height: 37rpx;
		}

		text {
			color: #4b9cff;
			font-size: 30rpx;
			margin-left: 16rpx;
		}
	}
}

.scsj {
	color: #0d1d36;
	font-size: 26rpx;
}

.sctime {
	display: flex;
	align-items: center;
	color: #888d99;
	font-size: 30rpx;
	margin-left: 20rpx;
}

.ty {
	width: 18rpx;
	height: 18rpx;
	background: #888d99;
	border-radius: 50%;
}

.xmjz {
	color: #888d99;
	font-size: 30rpx;
	margin-left: 20rpx;
}

.xx {
	width: 2rpx;
	height: 2rpx;
	border: 2rpx dashed #888d99;
	opacity: 0.5;
	margin-left: 7rpx;
}

.zxjz {
	color: #0d1d36;
	font-size: 30rpx;
	font-weight: bold;
	margin-left: 40rpx;
}

.tp {
	width: 192rpx;
	height: 192rpx;
	border-radius: 10rpx;
	background-color: #f5f5f9;
	margin-left: 30rpx;
	margin-top: 24rpx;
}

.tyqk {
	color: #0d1d36;
	font-size: 26rpx;
}

.hekuai {
	color: #ffffff;
	font-size: 26rpx;
	width: 72rpx;
	height: 32rpx;
	background: #4f5a78;
	border-radius: 4rpx;
	text-align: center;
	line-height: 32rpx;
	margin-left: 22rpx;
}

.sd {
	width: 48rpx;
	height: 48rpx;
}

.word {
	display: flex;
	align-items: center;

	image {
		width: 41rpx;
		height: 37rpx;
	}

	text {
		color: #4b9cff;
		font-size: 30rpx;
		margin-left: 16rpx;
	}
}

.qymc {
	width: 102rpx;
	height: 118rpx;
	background-repeat: no-repeat;
	background-size: 100% auto;
	background-position: 0 bottom;

	text {
		color: #888d99;
		font-size: 20rpx;
		line-height: 118rpx;
		margin-left: 8rpx;
	}
}

.bzj {
	position: absolute;
	left: 550rpx;
	font-size: 36rpx;
	color: #fe5022;
}

.caozuo {
	width: 690rpx;
	height: 124rpx;
	background-color: #f5f5f9;
	margin-top: -10rpx;

	.baocun {
		width: 160rpx;
		height: 64rpx;
		background: #4b9cff;
		border-radius: 10px;
		color: #ffffff;
		font-size: 30rpx;
		line-height: 64rpx;
	}

	.quxiao {
		width: 160rpx;
		height: 64rpx;
		background: #ffffff;
		border-radius: 10rpx;
		color: #888d99;
		font-size: 30rpx;
		line-height: 64rpx;
	}
}

.sc {
	display: flex;
	align-items: center;
	width: 136rpx;
	height: 52rpx;
	border: 2rpx solid #ab61ff;
	border-radius: 26rpx;
	color: #ab61ff;
	font-size: 26rpx;

	image {
		width: 30rpx;
		height: 30rpx;
		margin-top: 5rpx;
		margin-left: 26rpx;
	}
}

.qylg {
	width: 102rpx;
	height: 118rpx;
	background-size: 100% auto;
	background-position: 0 bottom;
	text-align: center;
	overflow: hidden;
	display: flex;
	justify-content: center;
	align-items: center;
	text {
		color: #888d99;
		font-size: 24rpx;
		line-height: 35rpx;
		padding: 0 5rpx;
	}
}

.f-list {
	border-bottom: 2rpx solid #dadfed;
}

.name {
	font-size: 28rpx;
	color: #4c9cff;
}

.tz {
	width: 68rpx;
	color: #ffffff;
	font-size: 24rpx;
	height: 36rpx;
	background: #ab61ff;
	border-radius: 6rpx;
	margin-left: 20rpx;
}

.xz {
	width: 114rpx;
	height: 50rpx;
	background: #4c9cff;
	border-radius: 25rpx;
	color: #ffffff;
	font-size: 26rpx;
	text-align: center;
	line-height: 50rpx;
	float: right;
}

.rq {
	font-size: 28rpx;
	color: #888e9a;
}

.wjdx {
	font-size: 28rpx;
	color: #888e9a;
	margin-left: 20rpx;
}

.scroll-view_H {
	white-space: nowrap;

	.scroll-view-item_H {
		display: inline-block;
		width: 100%;
		height: 100px;
	}

	.uni-bg-red {
		background: red;
	}

	.uni-bg-green {
		background: green;
	}

	.uni-bg-blue {
		background: blue;
	}
}

.hz {
	color: #0d1d36;
	display: block;
	width: 200rpx;
}
.swiper {
	height: 500rpx;
}
</style>
